﻿using System;
using System.Drawing;
using System.Drawing.Imaging;

namespace IconCreator
{
    class Program
    {
        static void CreateSimpleIcon()
        {
            // 创建一个16x16的位图
            using (var bitmap = new Bitmap(16, 16))
            using (var graphics = Graphics.FromImage(bitmap))
            {
                // 设置背景为蓝色
                graphics.Clear(Color.Blue);
                
                // 绘制一个白色的"A"字母
                using (var font = new Font("Arial", 10, FontStyle.Bold))
                using (var brush = new SolidBrush(Color.White))
                {
                    graphics.DrawString("A", font, brush, 2, 1);
                }
                
                // 保存为ICO文件
                var iconHandle = bitmap.GetHicon();
                using (var icon = Icon.FromHandle(iconHandle))
                {
                    using (var fileStream = new System.IO.FileStream("../app_new.ico", System.IO.FileMode.Create))
                    {
                        icon.Save(fileStream);
                    }
                }
            }
            
            Console.WriteLine("Icon created successfully!");
        }
    }
}
